package com.hjh.gameforum.service.impl;


import com.hjh.gameforum.entity.UserProfile;
import com.hjh.gameforum.mapper.UserProfileMapper;
import com.hjh.gameforum.service.UserProfileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class UserProfileServiceImpl implements UserProfileService {

    private final UserProfileMapper userProfileMapper;
    @Override
    public UserProfile getUserProfile(int userId) {
        UserProfile userProfile = userProfileMapper.getUserProfile(userId);
        if (userProfile == null){
            throw new RuntimeException("用户不存在");
        }
        return userProfile;
    }

    @Override
    public void updateUserProfile(int userId, String introduction) {
        userProfileMapper.updateUserProfile(userId,introduction);
    }
}